package com.nine.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.nine.IService.OrderService;
import com.nine.IService.OrderService;
import com.nine.IService.OrderitemService;
import com.nine.entity.Order;
import com.nine.entity.Orderitem;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
public class OrderDetailAction extends ActionSupport{
	OrderService orderService;
	OrderitemService orderitemService;
	Order order;
	Orderitem orderitem;
	public OrderService getOrderService() {
		return orderService;
	}
	public void setOrderService(OrderService orderService) {
		this.orderService = orderService;
	}
	public OrderitemService getOrderitemService() {
		return orderitemService;
	}
	public void setOrderitemService(OrderitemService orderitemService) {
		this.orderitemService = orderitemService;
	}
	public Order getOrder() {
		return order;
	}
	public void setOrder(Order order) {
		this.order = order;
	}
	
	public String getOrderInfo(int orderId){
		Order order=orderService.getOrder(orderId);
		List<Orderitem> itemList=orderitemService.getOrderItemList(orderId);
		ActionContext ctx=ActionContext.getContext();
		HttpServletRequest request=(HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);
		request.setAttribute("order", order);
		request.setAttribute("itemList", itemList);
		return SUCCESS;
	}
	
}
